package com.userautentification.dao.imp;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.userautentification.dao.DataAccessLayerException;
import com.userautentification.dao.PhoneDao;
import com.userautentification.entities.Phone;


@Repository("phoneDao")
public class PhoneDaoImp extends GenericDaoHibernate<Phone, Long> implements
		PhoneDao {

	public PhoneDaoImp(Class<Phone> phone) {
		super(phone);

	}

	Log log = LogFactory.getLog(PhoneDaoImp.class);

	/**
	 * Insert a new Phone into the database.
	 * 
	 * @param phone
	 */
	public Phone save(Phone phone) throws DataAccessLayerException {
		return super.save(phone);
	}

	/**
	 * Delete a detached Phone from the database.
	 * 
	 * @param phone
	 */
	public void remove(Phone phone) throws DataAccessLayerException {
		super.remove(phone.getId());
	}

	/**
	 * Updates the state of a detached Phone.
	 * 
	 * @param phone
	 */
	public void update(Phone phone) throws DataAccessLayerException {
		super.save(phone);
	}

	/**
	 * Finds all Phone in the database.
	 * 
	 * @return
	 */
	public List<Phone> getAll() throws DataAccessLayerException {
		return super.getAll();
	}

	/**
	 * Finds all distinct Phone in the database.
	 * 
	 * @return
	 */
	public List<Phone> getAllDistinct() {

		return super.getAllDistinct();

	}

	/**
	 * Finds a Phone in the database.
	 * 
	 * @return
	 */
	public Phone get(long id) {
		return super.get(id);
	}

	/**
	 * Return true if a Phone exist in the database.
	 * 
	 * @return
	 */
	public boolean exists(Long id) {
		return super.exists(id);
	}

	/**
	 * Return a list of Phones that exist in the database.
	 * 
	 * @return
	 */
	public List<Phone> findByNamedQuery(String queryName,
			Map<String, Object> queryParams) {
		return super.findByNamedQuery(queryName, queryParams);
	}

}